package org.singleton.junior;

import java.util.Arrays;

/**
 * TODO
 * @author singleton-zw
 * @date 2021/11/5 22:13
 */
public class containsDuplicate {
    public static void main(String[] args) {
        int nums [] = {1,2,3,4};
        rpc(nums);
        System.out.println(rpc(nums));
        System.out.println();
//        System.out.println(cd(nums));
    }

    private static boolean rpc(int[] nums) {
        int tem[] = new int[nums.length];
        for (int i = 0; i < nums.length ; i++) {
            tem[i] = nums[i];
        }
        System.out.println(Arrays.toString(tem));
        for (int j = 0; j < nums.length; j++) {
            if (nums[j] == tem[j]) {
                return true;
            }
        }
        return false;
    }

    /**
     *
     * @param nums
     * @return
     */
    private static boolean cd(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            for (int j = i+1; j < nums.length; j++) {
                if(nums[i]==nums[j]){
                   return true;
                }
            }
        }
        return false;
    }
}
